const { createProxyMiddleware }=require("http-proxy-middleware");

module.exports=(app)=>{ 
    app.use(createProxyMiddleware('/api', {
        target: "http://localhost:3000",//目标
        changeOrigin: true,//是否允许跨域  true:是  false:否
        ws: true,//websocket长连接
        pathRewrite: {//路径重写
            "^/api":"http://localhost:3000"
        },
    }));
}